package com.realbrand.net.realbrandpay.ui.activity.mall;

import com.realbrand.net.realbrandpay.base.BasePersenter;

/**
 * Created by Administrator on 2018/5/17.
 */

public class PersenterUpdataDeailResult extends BasePersenter<IViewUpdataDeailResult> {
    /**
     * 获取更新商品数量的结果
     *
     * @param param
     */

    public void getUpdataDeailResult(String param) {
        if (!isViewAttched()) {
            return;
        }
        ModelMollCar.getUpDataDeailResult(param, new IModelUpdataDeail<String>() {
            @Override
            public void onSuccess(String data) {
                if (isViewAttched()) {
                    getView().showResult(data);
                }
            }

            @Override
            public void onFail(String msg) {
                if (isViewAttched()) {
                    getView().showFailMsg(msg);
                }
            }

            @Override
            public void onErrorr() {
                if (isViewAttched()) {
                    getView().showError();
                }
            }

            @Override
            public void onComplete() {

            }
        });
    }
//删除
    public void deleteResult(String prama) {
        if (!isViewAttched()) {
            return;
        }
        ModelMollCar.deleteCommodity(prama, new IModelUpdataDeail<String>() {
            @Override
            public void onSuccess(String data) {
                if (isViewAttched()) {
                    getView().showDeleteResult(data);
                }
            }

            @Override
            public void onFail(String msg) {
                if (isViewAttched()) {
                    getView().showFailMsg(msg);
                }
            }

            @Override
            public void onErrorr() {
                if (isViewAttched()) {
                    getView().showError();
                }
            }

            @Override
            public void onComplete() {

            }
        });
    }
    //提交订单
    public void commitOrder(String prama) {
        if (!isViewAttched()) {
            return;
        }
        ModelMollCar.commitOrder(prama, new IModelUpdataDeail<String>() {
            @Override
            public void onSuccess(String data) {
                if (isViewAttched()) {
                    getView().showDeleteResult(data);
                }
            }

            @Override
            public void onFail(String msg) {
                if (isViewAttched()) {
                    getView().showFailMsg(msg);
                }
            }

            @Override
            public void onErrorr() {
                if (isViewAttched()) {
                    getView().showError();
                }
            }

            @Override
            public void onComplete() {

            }
        });
    }

}
